{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 235,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "from IPython.core.interactiveshell import InteractiveShell\n",
    "InteractiveShell.ast_node_interactivity = \"all\" \n",
    "\n",
    "# 解决坐标轴刻度负号乱码\n",
    "plt.rcParams['axes.unicode_minus'] = False\n",
    "\n",
    "# 解决中文乱码问题\n",
    "plt.rcParams['font.sans-serif'] = ['Simhei']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 236,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Channel</th>\n",
       "      <th>Region</th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>12669</td>\n",
       "      <td>9656</td>\n",
       "      <td>7561</td>\n",
       "      <td>214</td>\n",
       "      <td>2674</td>\n",
       "      <td>1338</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>7057</td>\n",
       "      <td>9810</td>\n",
       "      <td>9568</td>\n",
       "      <td>1762</td>\n",
       "      <td>3293</td>\n",
       "      <td>1776</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>6353</td>\n",
       "      <td>8808</td>\n",
       "      <td>7684</td>\n",
       "      <td>2405</td>\n",
       "      <td>3516</td>\n",
       "      <td>7844</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>13265</td>\n",
       "      <td>1196</td>\n",
       "      <td>4221</td>\n",
       "      <td>6404</td>\n",
       "      <td>507</td>\n",
       "      <td>1788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>22615</td>\n",
       "      <td>5410</td>\n",
       "      <td>7198</td>\n",
       "      <td>3915</td>\n",
       "      <td>1777</td>\n",
       "      <td>5185</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>435</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>29703</td>\n",
       "      <td>12051</td>\n",
       "      <td>16027</td>\n",
       "      <td>13135</td>\n",
       "      <td>182</td>\n",
       "      <td>2204</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>436</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>39228</td>\n",
       "      <td>1431</td>\n",
       "      <td>764</td>\n",
       "      <td>4510</td>\n",
       "      <td>93</td>\n",
       "      <td>2346</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>437</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>14531</td>\n",
       "      <td>15488</td>\n",
       "      <td>30243</td>\n",
       "      <td>437</td>\n",
       "      <td>14841</td>\n",
       "      <td>1867</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>438</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>10290</td>\n",
       "      <td>1981</td>\n",
       "      <td>2232</td>\n",
       "      <td>1038</td>\n",
       "      <td>168</td>\n",
       "      <td>2125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>439</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2787</td>\n",
       "      <td>1698</td>\n",
       "      <td>2510</td>\n",
       "      <td>65</td>\n",
       "      <td>477</td>\n",
       "      <td>52</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>440 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Channel  Region  Fresh   Milk  Grocery  Frozen  Detergents_Paper  \\\n",
       "0          2       3  12669   9656     7561     214              2674   \n",
       "1          2       3   7057   9810     9568    1762              3293   \n",
       "2          2       3   6353   8808     7684    2405              3516   \n",
       "3          1       3  13265   1196     4221    6404               507   \n",
       "4          2       3  22615   5410     7198    3915              1777   \n",
       "..       ...     ...    ...    ...      ...     ...               ...   \n",
       "435        1       3  29703  12051    16027   13135               182   \n",
       "436        1       3  39228   1431      764    4510                93   \n",
       "437        2       3  14531  15488    30243     437             14841   \n",
       "438        1       3  10290   1981     2232    1038               168   \n",
       "439        1       3   2787   1698     2510      65               477   \n",
       "\n",
       "     Delicassen  \n",
       "0          1338  \n",
       "1          1776  \n",
       "2          7844  \n",
       "3          1788  \n",
       "4          5185  \n",
       "..          ...  \n",
       "435        2204  \n",
       "436        2346  \n",
       "437        1867  \n",
       "438        2125  \n",
       "439          52  \n",
       "\n",
       "[440 rows x 8 columns]"
      ]
     },
     "execution_count": 236,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#导入数据\n",
    "data=pd.read_csv(r'D:/360MoveData/Users/ASUS/Desktop/拉钩数据分析/模块8/Wholesale customers data.csv')\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 237,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 440 entries, 0 to 439\n",
      "Data columns (total 8 columns):\n",
      "Channel             440 non-null int64\n",
      "Region              440 non-null int64\n",
      "Fresh               440 non-null int64\n",
      "Milk                440 non-null int64\n",
      "Grocery             440 non-null int64\n",
      "Frozen              440 non-null int64\n",
      "Detergents_Paper    440 non-null int64\n",
      "Delicassen          440 non-null int64\n",
      "dtypes: int64(8)\n",
      "memory usage: 27.6 KB\n"
     ]
    }
   ],
   "source": [
    "#查看数据 无缺失值\n",
    "data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 238,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Channel</th>\n",
       "      <th>Region</th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>440.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.322727</td>\n",
       "      <td>2.543182</td>\n",
       "      <td>12000.297727</td>\n",
       "      <td>5796.265909</td>\n",
       "      <td>7951.277273</td>\n",
       "      <td>3071.931818</td>\n",
       "      <td>2881.493182</td>\n",
       "      <td>1524.870455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.468052</td>\n",
       "      <td>0.774272</td>\n",
       "      <td>12647.328865</td>\n",
       "      <td>7380.377175</td>\n",
       "      <td>9503.162829</td>\n",
       "      <td>4854.673333</td>\n",
       "      <td>4767.854448</td>\n",
       "      <td>2820.105937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>55.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>25.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>3127.750000</td>\n",
       "      <td>1533.000000</td>\n",
       "      <td>2153.000000</td>\n",
       "      <td>742.250000</td>\n",
       "      <td>256.750000</td>\n",
       "      <td>408.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>8504.000000</td>\n",
       "      <td>3627.000000</td>\n",
       "      <td>4755.500000</td>\n",
       "      <td>1526.000000</td>\n",
       "      <td>816.500000</td>\n",
       "      <td>965.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>16933.750000</td>\n",
       "      <td>7190.250000</td>\n",
       "      <td>10655.750000</td>\n",
       "      <td>3554.250000</td>\n",
       "      <td>3922.000000</td>\n",
       "      <td>1820.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>112151.000000</td>\n",
       "      <td>73498.000000</td>\n",
       "      <td>92780.000000</td>\n",
       "      <td>60869.000000</td>\n",
       "      <td>40827.000000</td>\n",
       "      <td>47943.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          Channel      Region          Fresh          Milk       Grocery  \\\n",
       "count  440.000000  440.000000     440.000000    440.000000    440.000000   \n",
       "mean     1.322727    2.543182   12000.297727   5796.265909   7951.277273   \n",
       "std      0.468052    0.774272   12647.328865   7380.377175   9503.162829   \n",
       "min      1.000000    1.000000       3.000000     55.000000      3.000000   \n",
       "25%      1.000000    2.000000    3127.750000   1533.000000   2153.000000   \n",
       "50%      1.000000    3.000000    8504.000000   3627.000000   4755.500000   \n",
       "75%      2.000000    3.000000   16933.750000   7190.250000  10655.750000   \n",
       "max      2.000000    3.000000  112151.000000  73498.000000  92780.000000   \n",
       "\n",
       "             Frozen  Detergents_Paper    Delicassen  \n",
       "count    440.000000        440.000000    440.000000  \n",
       "mean    3071.931818       2881.493182   1524.870455  \n",
       "std     4854.673333       4767.854448   2820.105937  \n",
       "min       25.000000          3.000000      3.000000  \n",
       "25%      742.250000        256.750000    408.250000  \n",
       "50%     1526.000000        816.500000    965.500000  \n",
       "75%     3554.250000       3922.000000   1820.250000  \n",
       "max    60869.000000      40827.000000  47943.000000  "
      ]
     },
     "execution_count": 238,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.describe() #fresh列到最后一列 数据范围差别很大需要标准化去除量纲"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 239,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.708333</td>\n",
       "      <td>0.539874</td>\n",
       "      <td>0.422741</td>\n",
       "      <td>0.011965</td>\n",
       "      <td>0.149505</td>\n",
       "      <td>0.074809</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.442198</td>\n",
       "      <td>0.614704</td>\n",
       "      <td>0.599540</td>\n",
       "      <td>0.110409</td>\n",
       "      <td>0.206342</td>\n",
       "      <td>0.111286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.396552</td>\n",
       "      <td>0.549792</td>\n",
       "      <td>0.479632</td>\n",
       "      <td>0.150119</td>\n",
       "      <td>0.219467</td>\n",
       "      <td>0.489619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.856837</td>\n",
       "      <td>0.077254</td>\n",
       "      <td>0.272650</td>\n",
       "      <td>0.413659</td>\n",
       "      <td>0.032749</td>\n",
       "      <td>0.115494</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.895416</td>\n",
       "      <td>0.214203</td>\n",
       "      <td>0.284997</td>\n",
       "      <td>0.155010</td>\n",
       "      <td>0.070358</td>\n",
       "      <td>0.205294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>435</th>\n",
       "      <td>0.776890</td>\n",
       "      <td>0.315197</td>\n",
       "      <td>0.419191</td>\n",
       "      <td>0.343549</td>\n",
       "      <td>0.004760</td>\n",
       "      <td>0.057646</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>436</th>\n",
       "      <td>0.990872</td>\n",
       "      <td>0.036146</td>\n",
       "      <td>0.019298</td>\n",
       "      <td>0.113919</td>\n",
       "      <td>0.002349</td>\n",
       "      <td>0.059258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>437</th>\n",
       "      <td>0.364462</td>\n",
       "      <td>0.388465</td>\n",
       "      <td>0.758545</td>\n",
       "      <td>0.010961</td>\n",
       "      <td>0.372237</td>\n",
       "      <td>0.046827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>438</th>\n",
       "      <td>0.937737</td>\n",
       "      <td>0.180530</td>\n",
       "      <td>0.203404</td>\n",
       "      <td>0.094594</td>\n",
       "      <td>0.015310</td>\n",
       "      <td>0.193653</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>439</th>\n",
       "      <td>0.672296</td>\n",
       "      <td>0.409601</td>\n",
       "      <td>0.605477</td>\n",
       "      <td>0.015680</td>\n",
       "      <td>0.115065</td>\n",
       "      <td>0.012544</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>440 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        Fresh      Milk   Grocery    Frozen  Detergents_Paper  Delicassen\n",
       "0    0.708333  0.539874  0.422741  0.011965          0.149505    0.074809\n",
       "1    0.442198  0.614704  0.599540  0.110409          0.206342    0.111286\n",
       "2    0.396552  0.549792  0.479632  0.150119          0.219467    0.489619\n",
       "3    0.856837  0.077254  0.272650  0.413659          0.032749    0.115494\n",
       "4    0.895416  0.214203  0.284997  0.155010          0.070358    0.205294\n",
       "..        ...       ...       ...       ...               ...         ...\n",
       "435  0.776890  0.315197  0.419191  0.343549          0.004760    0.057646\n",
       "436  0.990872  0.036146  0.019298  0.113919          0.002349    0.059258\n",
       "437  0.364462  0.388465  0.758545  0.010961          0.372237    0.046827\n",
       "438  0.937737  0.180530  0.203404  0.094594          0.015310    0.193653\n",
       "439  0.672296  0.409601  0.605477  0.015680          0.115065    0.012544\n",
       "\n",
       "[440 rows x 6 columns]"
      ]
     },
     "execution_count": 239,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#使用Normalizer 对Fresh到Detergents_Paper 标准化\n",
    "from sklearn.preprocessing import Normalizer \n",
    "data.iloc[:,2:]=Normalizer().fit_transform(data.iloc[:,2:])\n",
    "data.iloc[:,2:] \n",
    " "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 240,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Channel</th>\n",
       "      <th>Region</th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>0.708333</td>\n",
       "      <td>0.539874</td>\n",
       "      <td>0.422741</td>\n",
       "      <td>0.011965</td>\n",
       "      <td>0.149505</td>\n",
       "      <td>0.074809</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>0.442198</td>\n",
       "      <td>0.614704</td>\n",
       "      <td>0.599540</td>\n",
       "      <td>0.110409</td>\n",
       "      <td>0.206342</td>\n",
       "      <td>0.111286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>0.396552</td>\n",
       "      <td>0.549792</td>\n",
       "      <td>0.479632</td>\n",
       "      <td>0.150119</td>\n",
       "      <td>0.219467</td>\n",
       "      <td>0.489619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>0.856837</td>\n",
       "      <td>0.077254</td>\n",
       "      <td>0.272650</td>\n",
       "      <td>0.413659</td>\n",
       "      <td>0.032749</td>\n",
       "      <td>0.115494</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>0.895416</td>\n",
       "      <td>0.214203</td>\n",
       "      <td>0.284997</td>\n",
       "      <td>0.155010</td>\n",
       "      <td>0.070358</td>\n",
       "      <td>0.205294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>435</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>0.776890</td>\n",
       "      <td>0.315197</td>\n",
       "      <td>0.419191</td>\n",
       "      <td>0.343549</td>\n",
       "      <td>0.004760</td>\n",
       "      <td>0.057646</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>436</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>0.990872</td>\n",
       "      <td>0.036146</td>\n",
       "      <td>0.019298</td>\n",
       "      <td>0.113919</td>\n",
       "      <td>0.002349</td>\n",
       "      <td>0.059258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>437</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>0.364462</td>\n",
       "      <td>0.388465</td>\n",
       "      <td>0.758545</td>\n",
       "      <td>0.010961</td>\n",
       "      <td>0.372237</td>\n",
       "      <td>0.046827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>438</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>0.937737</td>\n",
       "      <td>0.180530</td>\n",
       "      <td>0.203404</td>\n",
       "      <td>0.094594</td>\n",
       "      <td>0.015310</td>\n",
       "      <td>0.193653</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>439</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>0.672296</td>\n",
       "      <td>0.409601</td>\n",
       "      <td>0.605477</td>\n",
       "      <td>0.015680</td>\n",
       "      <td>0.115065</td>\n",
       "      <td>0.012544</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>440 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Channel  Region     Fresh      Milk   Grocery    Frozen  \\\n",
       "0          2       3  0.708333  0.539874  0.422741  0.011965   \n",
       "1          2       3  0.442198  0.614704  0.599540  0.110409   \n",
       "2          2       3  0.396552  0.549792  0.479632  0.150119   \n",
       "3          1       3  0.856837  0.077254  0.272650  0.413659   \n",
       "4          2       3  0.895416  0.214203  0.284997  0.155010   \n",
       "..       ...     ...       ...       ...       ...       ...   \n",
       "435        1       3  0.776890  0.315197  0.419191  0.343549   \n",
       "436        1       3  0.990872  0.036146  0.019298  0.113919   \n",
       "437        2       3  0.364462  0.388465  0.758545  0.010961   \n",
       "438        1       3  0.937737  0.180530  0.203404  0.094594   \n",
       "439        1       3  0.672296  0.409601  0.605477  0.015680   \n",
       "\n",
       "     Detergents_Paper  Delicassen  \n",
       "0            0.149505    0.074809  \n",
       "1            0.206342    0.111286  \n",
       "2            0.219467    0.489619  \n",
       "3            0.032749    0.115494  \n",
       "4            0.070358    0.205294  \n",
       "..                ...         ...  \n",
       "435          0.004760    0.057646  \n",
       "436          0.002349    0.059258  \n",
       "437          0.372237    0.046827  \n",
       "438          0.015310    0.193653  \n",
       "439          0.115065    0.012544  \n",
       "\n",
       "[440 rows x 8 columns]"
      ]
     },
     "execution_count": 240,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 241,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x3e113400>]"
      ]
     },
     "execution_count": 241,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.lines.Line2D at 0x3e41afd0>"
      ]
     },
     "execution_count": 241,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD2CAYAAAA6eVf+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXxV9b3/+9cnE5knEjJuCPNMGMKMNlJQtCKKEtQ6QT22PR7P/bX39NTTn623re39/Tw+2nt/np/eqoDWgRK0gjhVbUs1zAmEWWRIyEQgkIQQkpDpe//IjiBk2Flk77V38nk+Hnmw3Vl7r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soi80sEyHv98uZjLjv3lyjbt2F+u5PoN0H4i9Z5OlnGHY8Aw5+MMOm4w2bv7zBjjs1/AD2kbDtjs/HoaeOaqZSJp+x/4O+AwEOUluSbQdlS7H/iNB/dZDPAp8DnwAjDe7n3mYiZb9tcV298MjLN7X/Ugl8f319XbBGKBV65axg/YAvy/wBFgqJfkSgJ2AAdoG2MP9NA+i6DtAPFz2s5lzXX3Z6xfXJHrnBK4EPjctP0Zpbqh+8x1uq96RkRCgO8Au40xJ+zO4wt68zPWL4q+UkqpNj49pq+UUqpntOgrpVQ/okVfKaX6ES36SinVj2jRV0qpfuT/B++Q0rWNAxfUAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#使用轮廓系数找到最优k\n",
    "from sklearn.cluster import KMeans \n",
    "from sklearn.metrics import silhouette_score #轮廓系数\n",
    "\n",
    " \n",
    "score=[]\n",
    "\n",
    "#将k值从2变化到6\n",
    "for i in range(2,7):\n",
    "    cluster= KMeans(n_clusters=i, random_state=0).fit(data)\n",
    "    score.append(silhouette_score(data,cluster.labels_))\n",
    "                 \n",
    "plt.plot(range(2,7),score)\n",
    "#给k最大的位置加虚线   #idxmax()[] 取最大索引   \n",
    "plt.axvline(pd.DataFrame(score).idxmax()[0]+2,ls=':')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 242,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2, 2, 2, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 0,\n",
       "       0, 2, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 0, 0, 2, 2,\n",
       "       2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 0, 2,\n",
       "       0, 2, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0, 0, 2, 2, 0, 2, 2, 2, 0,\n",
       "       0, 0, 0, 0, 2, 0, 2, 0, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2,\n",
       "       0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0,\n",
       "       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,\n",
       "       0, 2, 2, 0, 2, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 0, 2, 0, 2,\n",
       "       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 1, 3,\n",
       "       1, 1, 3, 3, 1, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1,\n",
       "       1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 1, 1, 3, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       3, 1, 3, 1, 3, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0,\n",
       "       0, 0, 0, 0, 0, 0, 0, 3, 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 1,\n",
       "       1, 3, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n",
       "       1, 3, 1, 3, 3, 3, 1, 1, 1, 1, 2, 2, 0, 2, 0, 0, 2, 2, 0, 2, 0, 2,\n",
       "       0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2,\n",
       "       0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n",
       "       2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0,\n",
       "       2, 0, 0, 2, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0])"
      ]
     },
     "execution_count": 242,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "\n",
    "n_clusters = 4\n",
    "cluster = KMeans(n_clusters=n_clusters, random_state=2021).fit(data)\n",
    "\n",
    "y_pred = cluster.labels_\n",
    "y_pred"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 243,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Int64Index([0, 2, 1, 3], dtype='int64')"
      ]
     },
     "execution_count": 243,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.Series(y_pred).value_counts().index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 244,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "([<matplotlib.patches.Wedge at 0x3e0f80f0>,\n",
       "  <matplotlib.patches.Wedge at 0x3e0a7668>,\n",
       "  <matplotlib.patches.Wedge at 0x3e0a7ef0>,\n",
       "  <matplotlib.patches.Wedge at 0x3e096c88>],\n",
       " [Text(0.07063723275079675, 1.0977296485698607, '0'),\n",
       "  Text(-0.8945124751038032, -0.6401932769747494, '2'),\n",
       "  Text(0.4498006200578961, -1.0038323576153203, '1'),\n",
       "  Text(1.0618377985976803, -0.28722898438220384, '3')],\n",
       " [Text(0.038529399682252774, 0.5987616264926512, '48.0%'),\n",
       "  Text(-0.4879158955111653, -0.34919633289531776, '23.9%'),\n",
       "  Text(0.2453457927588524, -0.5475449223356292, '19.8%'),\n",
       "  Text(0.5791842537805528, -0.15667035511756572, '8.4%')])"
      ]
     },
     "execution_count": 244,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x3e0f85f8>"
      ]
     },
     "execution_count": 244,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3de3xU1b338c+aPZnMJIGEkECAhIwgAt4QqS1oRS1eatPTire22pJa0T7Var30aefUXqYvj4+xXp7jU9vTc7St1BZ7qvW01dFWLSIoIAqCoySAkCCXJIQQhtwmk5m9nj92UNQEhmRmrz0z6/16zQt8ZWavXyTfrL33WnstIaVE0zTncakuQNO0welwappD6XBqmkPpcGqaQ+lwappD6XBqmkPpcGqaQ+lwappD6XBqmkPpcGqaQ7lVF6BpqbJu3bpxbrf7EeBknNfxmMDb8Xh88Zw5c/Ym8wEdTi1ruN3uRyoqKmaWl5d3uFwuR00aN01TtLW1ndjS0vII8IVkPuO03y6aNhInl5eXH3RaMAFcLpcsLy+PYPXqyX0mjfVomt1cTgzmIQO1JZ05fVqrZS1/IDQnlcdrqqtZl8rjHY3uOTXNoXQ4c4gQ4tdCiNVCiB+qriVbXXnlldWnnXbajO9973sTRnosHc4cIYS4FDCklPOAKUKIaapryjZLliwpSSQSYsOGDQ2NjY354XA4fyTH0+HMHecCfxr4+/PAp9WVkp1eeumlUVdeeWUHwAUXXBBZtmxZ0UiOp8OZOwqB3QN/3w+MV1hLVurp6XFNnjw5BlBWVpZobW3NG8nxdDhzRxfgG/h7EfrfPuUKCwvNnp4eF0BnZ6fLNM0RHU8PpeSOdVinsmuAWcBmteWkn91DH3PmzOl5+eWXixYsWNC9YcOGgunTp0dHcjwdztzxF2ClEGIicDEwV3E9Weeqq67qm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4NO/ofVgixXIfzyHQ4NSV0OI9OT3zXNIfS4dQ0h9KntZrmULrn1DSH0uHUNIfS4dQ0h9Lh1DSH0uHUNIfS4dQ0h9Lh1DSH0uHUNIfS4dQ0h9Lh1DSH0uHUNIfS4dQ0h9Lh1DSH0uHUNIfS4dQ0h9Lh1DSH0uHUNIfS4dQ0h9Lh1DSH0uHUNIfS4dQ0h9Lh1DSH0uHUNIfS4dQ0h/r/2a8QNeDWZUEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.pie(pd.Series(y_pred).value_counts(),labels=pd.Series(y_pred).value_counts().index,autopct='%1.1f%%')\n",
    "plt.legend()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 245,
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pd.concat([data.iloc[:,2:],pd.Series(y_pred)],axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 246,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.708333</td>\n",
       "      <td>0.539874</td>\n",
       "      <td>0.422741</td>\n",
       "      <td>0.011965</td>\n",
       "      <td>0.149505</td>\n",
       "      <td>0.074809</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.442198</td>\n",
       "      <td>0.614704</td>\n",
       "      <td>0.599540</td>\n",
       "      <td>0.110409</td>\n",
       "      <td>0.206342</td>\n",
       "      <td>0.111286</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.396552</td>\n",
       "      <td>0.549792</td>\n",
       "      <td>0.479632</td>\n",
       "      <td>0.150119</td>\n",
       "      <td>0.219467</td>\n",
       "      <td>0.489619</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.856837</td>\n",
       "      <td>0.077254</td>\n",
       "      <td>0.272650</td>\n",
       "      <td>0.413659</td>\n",
       "      <td>0.032749</td>\n",
       "      <td>0.115494</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.895416</td>\n",
       "      <td>0.214203</td>\n",
       "      <td>0.284997</td>\n",
       "      <td>0.155010</td>\n",
       "      <td>0.070358</td>\n",
       "      <td>0.205294</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>435</th>\n",
       "      <td>0.776890</td>\n",
       "      <td>0.315197</td>\n",
       "      <td>0.419191</td>\n",
       "      <td>0.343549</td>\n",
       "      <td>0.004760</td>\n",
       "      <td>0.057646</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>436</th>\n",
       "      <td>0.990872</td>\n",
       "      <td>0.036146</td>\n",
       "      <td>0.019298</td>\n",
       "      <td>0.113919</td>\n",
       "      <td>0.002349</td>\n",
       "      <td>0.059258</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>437</th>\n",
       "      <td>0.364462</td>\n",
       "      <td>0.388465</td>\n",
       "      <td>0.758545</td>\n",
       "      <td>0.010961</td>\n",
       "      <td>0.372237</td>\n",
       "      <td>0.046827</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>438</th>\n",
       "      <td>0.937737</td>\n",
       "      <td>0.180530</td>\n",
       "      <td>0.203404</td>\n",
       "      <td>0.094594</td>\n",
       "      <td>0.015310</td>\n",
       "      <td>0.193653</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>439</th>\n",
       "      <td>0.672296</td>\n",
       "      <td>0.409601</td>\n",
       "      <td>0.605477</td>\n",
       "      <td>0.015680</td>\n",
       "      <td>0.115065</td>\n",
       "      <td>0.012544</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>440 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        Fresh      Milk   Grocery    Frozen  Detergents_Paper  Delicassen  \\\n",
       "0    0.708333  0.539874  0.422741  0.011965          0.149505    0.074809   \n",
       "1    0.442198  0.614704  0.599540  0.110409          0.206342    0.111286   \n",
       "2    0.396552  0.549792  0.479632  0.150119          0.219467    0.489619   \n",
       "3    0.856837  0.077254  0.272650  0.413659          0.032749    0.115494   \n",
       "4    0.895416  0.214203  0.284997  0.155010          0.070358    0.205294   \n",
       "..        ...       ...       ...       ...               ...         ...   \n",
       "435  0.776890  0.315197  0.419191  0.343549          0.004760    0.057646   \n",
       "436  0.990872  0.036146  0.019298  0.113919          0.002349    0.059258   \n",
       "437  0.364462  0.388465  0.758545  0.010961          0.372237    0.046827   \n",
       "438  0.937737  0.180530  0.203404  0.094594          0.015310    0.193653   \n",
       "439  0.672296  0.409601  0.605477  0.015680          0.115065    0.012544   \n",
       "\n",
       "     type  \n",
       "0       2  \n",
       "1       2  \n",
       "2       2  \n",
       "3       0  \n",
       "4       2  \n",
       "..    ...  \n",
       "435     0  \n",
       "436     0  \n",
       "437     2  \n",
       "438     0  \n",
       "439     0  \n",
       "\n",
       "[440 rows x 7 columns]"
      ]
     },
     "execution_count": 246,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=df.rename(columns={0:'type'})\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 247,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Fresh</th>\n",
       "      <th>Milk</th>\n",
       "      <th>Grocery</th>\n",
       "      <th>Frozen</th>\n",
       "      <th>Detergents_Paper</th>\n",
       "      <th>Delicassen</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.726630</td>\n",
       "      <td>0.258153</td>\n",
       "      <td>0.301331</td>\n",
       "      <td>0.231547</td>\n",
       "      <td>0.064935</td>\n",
       "      <td>0.098369</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.708526</td>\n",
       "      <td>0.242769</td>\n",
       "      <td>0.315623</td>\n",
       "      <td>0.251203</td>\n",
       "      <td>0.072341</td>\n",
       "      <td>0.080001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.400221</td>\n",
       "      <td>0.419813</td>\n",
       "      <td>0.632576</td>\n",
       "      <td>0.068583</td>\n",
       "      <td>0.271976</td>\n",
       "      <td>0.078460</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.286085</td>\n",
       "      <td>0.408626</td>\n",
       "      <td>0.670728</td>\n",
       "      <td>0.103508</td>\n",
       "      <td>0.317349</td>\n",
       "      <td>0.069563</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         Fresh      Milk   Grocery    Frozen  Detergents_Paper  Delicassen\n",
       "type                                                                      \n",
       "0     0.726630  0.258153  0.301331  0.231547          0.064935    0.098369\n",
       "1     0.708526  0.242769  0.315623  0.251203          0.072341    0.080001\n",
       "2     0.400221  0.419813  0.632576  0.068583          0.271976    0.078460\n",
       "3     0.286085  0.408626  0.670728  0.103508          0.317349    0.069563"
      ]
     },
     "execution_count": 247,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1=df.groupby('type').mean() \n",
    "#df1[df1.index==0].values.reshape(6)\n",
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 248,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.72662978, 0.70852612, 0.40022121, 0.28608539])"
      ]
     },
     "execution_count": 248,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1['Fresh'].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 249,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2, 0, 1, 3], dtype=int64)"
      ]
     },
     "execution_count": 249,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "labels = [0,1,2,3]\n",
    "df['type'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 250,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 1008x720 with 0 Axes>"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 4 artists>"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 4 artists>"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 4 artists>"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 4 artists>"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 4 artists>"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 4 artists>"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x3e06dc18>"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "([<matplotlib.axis.XTick at 0x3e0c9f60>,\n",
       "  <matplotlib.axis.XTick at 0x3e09e080>,\n",
       "  <matplotlib.axis.XTick at 0x3e09e400>,\n",
       "  <matplotlib.axis.XTick at 0x3e038d68>],\n",
       " <a list of 4 Text xticklabel objects>)"
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAzEAAAI9CAYAAAAKI/ZPAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1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TOXPmZPLkybn66qtz0EEHZcSIEfniF7+Yo48+OqtWrUpXV1enxwQAgB1WaZpmuz9pV1dXs2jRohfdt3Tp0owZM2a7z8K24fcJAMArVUpZ3DTNS44QOBIDAABURcQAAABVETEAAEBVRAwAAFAVEQMAAFRl0H7YZU/P9t9v1qxZeeqpp3LzzTdn+vTp2X333XP99dfnvPPOyxe+8IUXre3u7k5vb2+S5Prrr9/0eAAAYNtyJKaf++6770X/N8lLAgYAAOgcEdPPrrvumjVr1mSXXXbZdF93d3dLj73//vtz/PHH58knn9xG0wEAAIP2dLJOmThxYr7xjW9k4sSJL+txK1euzAc/+MF897vfzV577bWNpgMAAByJSfLI00/nkaefzlPPPpuDJ0zINdddl4MnTMhTzz6bR55+Os8899ymNf/53wvve2LDhnzxS1/K6w84IIv+/d87/XIAAGCHJmL6GX/YYfnJokUZf9hhL+tx//v55+eyL34xf/+Zz2yjyQAAgETEvMRBb3xjRh1ySN4wfPjLetxuu+2WAw86KG8aPTrf+c53ttF0AABAaZpmuz9pV1dXs2jRohfdt3Tp0owZM2a7z5JsPJ2snQ7Ybbe27lejTv4+AQDYMZRSFjdN09X/fkdiAACAqogYAACgKiIGAACoiogBAACqImIAAICqDOn0AJuzbFlPW/cbOXLL+zVNk//zk5/MT3/847z+j/84//C1r2XXXXdt6xwAAMAr40jMC8y/88786qGHcstdd2X0W96S2771rU6PBAAA9DNoj8R0wsJ58zJp8uQkyZkf/Wg2bNiQaVOmZGJXV5b+9Ke56bbb8vTTT+evzz47j65cmf9y4IG54ppr8txzz+WvzzknKx9+OK993evynW9+M0kyY8aMPPbYYxk/fny+/OUvJ0m6u7vz9re/PUuWLMncuXPzd3/3dxkzZkymT5+enp6eHHrooZk+fXrHfgYAADDYORLzAmt+/evstdde+eaNN2bm+9+fOd/+dn50771525FH5qbbbkuS3PTVr2b02LH51ve+l5FvelP+5w035MZrr81bxo/PLXfdlf/63vfmZz/7WWbPnp1x48Zl3rx5WblyZZYsWZIkueeeezJp0qTMnT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znwwFxxzTW59wc/yBcuvTRJsviHP8yyZcvyute9LjNmzMhjjz2W8ePH58tf/nJ6enqyYcOGzJ8/P+vWrct3v/vd7L///h1+hQAAUJdW3hPzqvLFz30u06ZMyfl/9VdJkh/de2/eduSRuem225IkN331qxk9dmy+9b3vZeSb3pT/ecMNOfb44/PNO+7I1A98ILM+8pEccMABmT17dsaNG5d58+Zl5cqVWbJkSZLkwQcfzLx58zJ16tTceeedHXudAABQq5aOxLya9D+dbPTYsXnPe9+76etfLl2aE085JUny1iOPzF1z5yZJfnbfffn2P/9zbrz11iTJAw88kAULFqS3tzdr167NihUbr1I9Y8aMJMnw4cPzzDPPbJfXBAAAOxJHYrZg6NChL/p69Fvekh/de2+S5Ec//GHePGZM1v3mNzn/r/4qX/jKVzJkyMYuHD16dM4777z09vbm4osvzvDhwwfcDwAAeHlEzMv0gTPOyC9//vNMfec7s+zBB3PqjBm54R//MSsffjgfnzUr06ZMyd13351zzjknc+bMyeTJk3P11VfnoIMO6vToAACwQyid+FiXrq6uZtGiRS+6b+nSpRkzZsx2nyVJHnn66bbud8Buu7V1vxp18vfJK9ezbFl79xs5sq37AQCvDqWUxU3TdPW/35EYAACgKiIGAACoiogBAACqImIAAICqiBgAAKAqg/fDLnt6Bvd+AABARzgS8wLnnX12phxxRE48+ujceO21m1234O6786vly7ffYH16e3uzfCued9asWTn88MNz3HHH5eSTT8769evbPxwAAGwnIqafSz7/+dx466254tJL8/Of/nTANQvnzcuvHnpoO0+29RGTJFdeeWXmz5+fI488MjfeeGN7BwMAgO1o8J5O1kH77Ltv3nnCCfnut7+dSy+4IOvWrcuU97wnH//v/z1/fc45WXD33fnurbdm9Jgx+dINN2T1o4/mr885Z9O6y/72b7N8+fJccMEF2XXXXZMk1113XR599NH82Z/9WX7/+99n9OjRecc73pGTTz45s2bNym9+85ucfPLJOf/88zNr1qyMGjUqd9xxR5599tn867/+az760Y/mrrvuyi233JKxY8fmxhtvzGOPPZbTTjstGzZsyNixY/OP//iPW3xt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8r/9txet+8jpp+fhhx9+yd5ve9vb8v73vz8jR47MgQcemMsuuyyf/vSnc9ZZZ+XCCy/MyJEjM3369M3O9v73vz9nnnlmLrroonz961/PqFGjMnPmzGzYsCH7779/3vjGN7b8Ok866aR8+MMfzrBhw/Ka17wmK1asSJLcdtttufrqq3PEEUfksMMOyyGHHJIzzjgj1113XV772tfmpptuepk/UQAAaK/SNM12f9Kurq5m0aJFL7pv6dKlGTNmzHafJUkeefrptu53wG67DXh/T09PfvCDH2TnnXfOkCFD8rnPfS5jx45t63O/ErNmzUpPT09GjBjxivfq5O+TV65n2bL27jdyZFv3A4A/xOlkO45SyuKmabr63z94j8TsgHq28dGlVatWveRIzujRo1u6almSXH/99dtgKgAAaC8RswPZf//909vb2+kxAABgm3KJZQAAoCoiBgAAqIqIAQAAqjJ43xOzfEV79xtx4BaXnHf22bl/yZIMGTIkf3HWWfngWWdtdu20KVPyzTvu2PT1Y6tW5eavfS1/+alPtWVcAABgYIM3Yjrkks9/Pm869NBMOeKIHH7EEXnL+PEtPe6P999fwAAAwHbgdLIB7LPvvnnnCSfku9/+dv7iT/80f9rdnSsvv/wPPuZXy5fnvLPP3vT1r3/965x00kmZNGlSZs6cmeeeey6PPPJIjj322Bx33HG54IILkiSPPfZYjj/++Bx77LH50Ic+tNn7Hn300Zx44ok5+uijc9lllyXZ+LkuF110UY477rgcffTR+d3vfrctfhwAADCoiJjN2HufffKFyy7LydOm5Tu9vZl76615fM2alh9/6aWX5oMf/GAWLlyYsWPH5qGHHsqKFSvy2c9+NnPmzMmtt96aJJk/f37Gjx+f73//+5k8eXKee+65Ae+77LLLctppp2XBggW55ZZbsqZvlvXr12f+/Pk59NBD8+Mf/3ib/CwAAGAwETGbsfaJJ/Lss8/ma9dck2lTpuSp3/42j65c2fLjf/GLX+SII45IknzqU5/KiBEjMmTIkHz2s5/N2WefnSeffDJJcuKJJ+bZZ5/NlClT8otf/CI77bTTgPc98MADueqqq9Ld3Z3f/va3eeSRR5IkM2fOTJ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9b9zSAsPXJ9kj77be2bgozdbXNM0zewks1sadZAqpSxqmqar03PAYOFvAl7M3wS8lL8LtoVWTidbnOdPD5uYZPlWrgEAAHjFWjkSc0uS+aWUA5KcmGR6KeXipmku/ANrjmr/qAAAAC0ciWmaZl02vnH/niTHN01zX7+AGWjNb9o/6qBQ9elwsA34m4AX8zcBL+Xvgrbb4hv7AQAABpOWPuwSAABejlLKPqWUKaWU13d6FnY8IqZFpZRrSykLSykXbnk17PhKKfuVUuZ3eg4YDEopf1RKmVNKub2U8i+llF07PRN0Uill7yS3JTkiyV2llJdcIhdeCRHTglLK1CQ7N00zKcmoUsohnZ4JOqnvf5xuSDK007PAIPHBJFc0TfOuJKuSnNDheaDTJiT5RNM0lySZm+StHZ6HHYyIaU13kpv7bt+e5y8nDa9WzyY5Lcm6Tg8Cg0HTNP/QNM0dfV8OS/JYJ+eBTmua5u6mae4ppUzOxqMxCzs9EzsWEdOaoUlW9N1+PMl+HZwFOq5pmnU78FUIYauVUiYl2btpmns6PQt0WimlZOP/w+uJJBs6PA47GBHTmvVJ9ui7vWf83ADop5SyT5Irk5zZ6VlgMGg2+liSJUn+tNPzsGPxj/HWLM7zp5BNTLK8c6MAMNj0vZH/n5Oc3zTNQ52eBzqtlPI3pZQZfV++LsnaTs7DjsfnxLSglPLaJPOT/GuSE5Mc5VQaSEopvU3TdHd6Dui0UspHklya5L6+u65qmuYbHRwJOqrvAjA3J9ktyc+SfKzxj07aSMS0qO+PcUqSeU3TrOr0PAAA8GolYgAAgKp4TwwAAFAVEQMAAFRFxAAAAFURMQAAQFVEDAAAUBURAwAAVOX/B3zqR+Kv3A3oAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1008x720 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "# 数据\n",
    "#labels =['0','1','2','3']\n",
    "x=np.arange(len(labels))\n",
    "bar_width=0.1\n",
    "y1 =df1['Fresh'].values \n",
    "y2 = df1['Milk'].values  \n",
    "y3 = df1['Grocery'].values   \n",
    "y4=df1['Frozen'].values\n",
    "y5=df1['Detergents_Paper'].values\n",
    "y6=df1['Delicassen'].values\n",
    "# 画图\n",
    "plt.figure(figsize=(14, 10))      \n",
    "plt.bar(x,y1,bar_width,color=\"c\",align=\"center\",label=\"Fresh\",alpha=0.5)\n",
    "plt.bar(x+bar_width,y2,bar_width,color=\"b\",align=\"center\",label=\"Milk\",alpha=0.5)\n",
    "plt.bar(x+bar_width*2,y3,bar_width,color=\"y\",align=\"center\",label=\"Grocery\",alpha=0.5) \n",
    "plt.bar(x+bar_width*3,y4,bar_width,color=\"g\",align=\"center\",label=\"Frozen\",alpha=0.5)\n",
    "plt.bar(x+bar_width*4,y5,bar_width,color='r',align=\"center\",label=\"Detergents_Paper\",alpha=0.5)\n",
    "plt.bar(x+bar_width*5,y6,bar_width,color=\"pink\",align=\"center\",label=\"Delicassen\",alpha=0.5)\n",
    "# 图例\n",
    "plt.legend(loc = 'upper left')\n",
    "plt.xticks(ticks=[0,1,2,3])\n",
    "plt.show()\n",
    " "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "autoclose": false,
   "autocomplete": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 1,
   "hotkeys": {
    "equation": "Ctrl-E",
    "itemize": "Ctrl-I"
   },
   "labels_anchors": false,
   "latex_user_defs": false,
   "report_style_numbering": false,
   "user_envs_cfg": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
